﻿ @model WebVideo.EntityThongBao
@{ 
    if ( ViewBag.quangcao == 1 )
    {
        <div id="ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv" style="display:none">
            <div id="overPage">
              
            </div>
          <div id="floating" >
                
                <div>
                    <div class="modal-header">Quảng cáo</div>
                    <div class="cont">
                        @Html.Raw(Model.NoiDung)
                    </div>                       
                </div>          
               
                <p>
                    <a href="javascript:closeMe();"><img src="http://www.freestockphotos.biz/pictures/15/15107/Illustration+of+a+red+close+button.png" width="20px" height="20px"/></a>
                </p>
          </div>
</div>
<script language="javascript" type="text/javascript">
    function opennew() {
        var expire = new Date();
        expire = new Date(expire.getTime() + 1800000);
        document.cookie = "VFGEN-FORUM=here; expires=" + expire;     
    }

    function GetCookie(name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
            var j = i + alen;
            if (document.cookie.substring(i, j) == arg)
                return "here";
            i = document.cookie.indexOf(" ", i) + 1;
            if (i == 0) break;
        }
        return null;
    }

    var visit = GetCookie("VFGEN-FORUM");
    if (visit == null) {
        $("#ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv").show();
    }
    var lastScroll;
    var delay = 30;
    var speed = 50;
    var img_w = 690;
    var img_h = 660;
    function centerIt() {
        $("#overPage").css("width", $(window).width());
        $("#overPage").css("height", $(document).height());
        //$("#floating").css("left", $(window).width() / 2 - img_w / 2);
        //$("#floating").css("top", $(window).height() / 2 - img_h / 2 + $(document).scrollTop());
    }
    $(document).ready(function () {
        $("#overPage").css("opacity", 0.7);
        $("#overPage,#floating").show();
        centerIt();
    });
    //$(window).scroll(function () {
    //    setTimeout(function () { ani(); }, delay);
    //    lastScroll = new Date().getTime();
    //});
    $(window).resize(function () {
        centerIt();
    });
    //function ani() {
    //    if ((new Date().getTime() - lastScroll) >= (delay - 20)) {
    //        $("#floating").animate({ top: ($(window).height() / 2 - img_h / 2 + $(document).scrollTop()) }, speed);
    //    }
    //}
    function closeMe() {
        $("#overPage,#floating").hide();        
            opennew();
            
    }

</script>
<!-----------end popup---------------->
    }
}
